package cn.com.cifi.mars.bean.vo.price;

import cn.com.cifi.mars.constant.OrgTypeEunm;
import cn.com.cifi.mars.util.MathUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author plx
 */
@ApiModel("货值报表")
@Data
public class PriceReportVO implements Serializable{

    @ApiModelProperty("组织ID")
    private String orgId;

    @ApiModelProperty("父级ID")
    private String parentOrgId;

    @ApiModelProperty("组织名称")
    private String orgName;

    @ApiModelProperty("组织类型")
    private String orgType;

    @ApiModelProperty("房间总金额")
    private BigDecimal roomTotalPrice;

    @ApiModelProperty("车位总金额")
    private BigDecimal carPlateTotalPrice;

    @ApiModelProperty("房间套数")
    private Integer roomCount;

    @ApiModelProperty("车位个数")
    private Integer carPlateCount;

    @ApiModelProperty("权益货值")
    private BigDecimal rightPrice;

    @ApiModelProperty("面积")
    private BigDecimal area;

    @ApiModelProperty("分组CODE")
    private String groupCode;

    @ApiModelProperty("分组名称")
    private String groupName;

    @ApiModelProperty("是否是车位")
    private Integer isParking;

    @ApiModelProperty("是否已供")
    private Integer isSupply;

    @ApiModelProperty("货值版本名称")
    private String versionName;


    @ApiModelProperty("货值版本名称")
    private String versionType;


    public void addToParent(PriceReportVO parent){
        parent.setRoomCount(MathUtils.integerAdd(this.roomCount, parent.getRoomCount()));
        parent.setCarPlateCount(MathUtils.integerAdd(this.carPlateCount, parent.getCarPlateCount()));
        parent.setArea(MathUtils.bigDecimalAdd(this.area, parent.getArea()));
        parent.setRoomTotalPrice(MathUtils.bigDecimalAdd(this.getRoomTotalPrice(), parent.getRoomTotalPrice()));
        parent.setCarPlateTotalPrice(MathUtils.bigDecimalAdd(this.carPlateTotalPrice, parent.getCarPlateTotalPrice()));
        parent.setRightPrice(MathUtils.bigDecimalAdd(this.rightPrice, parent.getRightPrice()));
        if (OrgTypeEunm.ORG_BUILD.getKey().equals(parent.getOrgType()) && isSupply != null && parent.getIsSupply() == null){
            parent.setIsSupply(isSupply);
        }
    }

}
